<template>
  <div class="app-container">
    <h2>App根组件</h2>
    <p>子传父的数据：{{ countFromson }}</p>
    <hr />

    <div class="box">
      <Left :msg="message" :user="userinfo"></Left>
      <Right @numchange="getnumchange"></Right>
    </div>
  </div>
</template>

<script>
import Left from "@/components/Left.vue";
import Right from "@/components/Right";

export default {
  data() {
    return {
      message: "父向子传值",
      userinfo: { name: "hyl", age: 18 },
      countFromson: 0,
    };
  },

  methods: {
    getnumchange(val) {
      this.countFromson = val;
    },
  },
  components: {
    Left,
    Right,
  },
};
</script>

<style lang="less">
.app-container {
  padding: 1px 20px 20px;
  background-color: #efefef;
}
.box {
  display: flex;
}
</style>
